package com.wxw.gulidemo.handler;/**
 * @author by xxz
 * @date 2022/5/26
 */

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;

import org.apache.ibatis.reflection.MetaObject;

import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @Description         配置mybatis-plus  自动填充

 * @author by xxz

 * @date 2022/5/26

 * @throws
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject,"gmtCreate",LocalDateTime.class, LocalDateTime.now());
        this.strictInsertFill(metaObject,"gmtModified",LocalDateTime.class, LocalDateTime.now());
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.strictUpdateFill(metaObject,"gmtModified",LocalDateTime.class, LocalDateTime.now());
    }
}
